<%@page	import="org.springframework.web.context.request.RequestAttributes"%>
<%@page import="org.springframework.web.servlet.ModelAndView"%>
<%@page import="ar.com.sectorwine.controllers.EmpresasController"%>
<%@page import="org.springframework.ui.Model"%>
<%@ page session="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<jsp:include page="../cabecera_home.jsp"></jsp:include>

<div class="marquesina_index" align="center">

	<br> <br> <br>
	
	<h1>Stock Cargado</h1>

	<%
		try {
	%>
	<form:form method="post" modelAttribute="mis_stocks">

		<table>
			<tr>
				<td valign="top">
					<table border="1" border=1 bgcolor=#FFFFFF>
						<tr>
							<td align="left">Variedad</td>
							<td align="left">Cantidad</td>
							<td align="left">Creado</td>
							<td align="left">Vencimiento</td>
							<td align="left">Estado</td>
							<td align="left">Detalles</td>
						</tr>
						<c:forEach items="${mis_stocks}" var="stocks">
							<tr>
								<td align="left">${stocks.variedad}</td>
								<td align="left">${stocks.cantidad}</td>
								<td align="left"><fmt:formatDate
										value="${stocks.fechaCreacionStock}" pattern="MM/dd/yyyy"
										timeZone="GMT" /></td>
								<td align="left"><fmt:formatDate
										value="${stocks.vencimiento}" pattern="MM/dd/yyyy"
										timeZone="GMT" /></td>


								<c:choose>
									<c:when test='${stocks.fechaVenta != null}'>
       									<td align="left"><span style="color: red;">Vendido</span></td>
    								</c:when>
									<c:otherwise>
        								<td align="left"><span style="color: green;">Disponible</span></td>
    								</c:otherwise>
								</c:choose>
								<td align="left"><a href="stocks_detalle?id=${stocks.id}">VER</a></td>
							</tr>

						</c:forEach>

					</table>
				</td>

			</tr>
		</table>

	</form:form>

	<%
		} catch (Exception e) {
			out.print(e.getMessage());
		}
	%>

</div>

<jsp:include page="../pie_de_pagina_compartida.jsp"></jsp:include>
